package com.atguigu.guli.edu.controller.admin;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.atguigu.common_utils.utils.PageUtils;
import com.atguigu.common_utils.utils.R;
import com.atguigu.guli.edu.entity.Subject;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.atguigu.guli.edu.service.EduSubjectService;
import org.springframework.web.multipart.MultipartFile;


/**
 * 课程科目
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-01-19 10:59:18
 */
@Api(tags = "课程分类模块")

@RestController
@RequestMapping("/admin/edu/subject")
public class EduSubjectController {
    @Autowired
    private EduSubjectService eduSubjectService;

    //上传文件
    @PostMapping("/import")
    public R importFile(@RequestParam("file") MultipartFile file){
        eduSubjectService.importFile(file);
        return R.ok();
    }

    //三级分类查询
    @GetMapping("/level")
    public R selectLevel(){
        List<Subject> subjects = eduSubjectService.selectLevel();
        return R.ok().put("data",subjects);
    }

}
